<?php
header('content-type:text/html;charset=utf-8');
include('common.php');
include(S_ROOT.'source/class_curl.php');
//乐天测试账号
$op = isset($_GET['op']) ? trim($_GET['op']) : 'index';
set_time_limit(100);
$account = array(
	'username' => 'ra3@mancyphoto.com',
	'password' => 'yu314159'
);
switch($op)
{
	case 'index':

		$letian = new Curl('letian', $account, false);
		
		//登陆过程
		foreach($account as $key => &$val){
			$val = urlencode($val);
		}
		$postDate = array(
			'url' => 'https://grp02.id.rakuten.co.jp/rms/nid/login',
			'data' => "u={$account['username']}&p={$account['password']}&submit=%A5%ED%A5%B0%A5%A4%A5%F3",			
		);
		//print_r($postDate);exit;
		
		$html = $letian->post($postDate,'', 'euc-jp');
		//exit($html);
		//发送商品基本信息
		$html = $letian->get('https://auction.item.rms.rakuten.co.jp/rms/c2c/item/DI01P001_001', '', 'euc-jp');
		exit($html);
		//<input type="hidden" name="d_id" value="d133fb2519e4c40d6816d6975ee24a05" >
			
		$data = array(
			
		);
		$postDate = array(
			'url' => 'https://auction.item.rms.rakuten.co.jp/rms/c2c/item/DI01P001_004',
			'data' => "d_id=7f9501ca8d1e96024f284b1e975571f0&genreNewText=%A5%E1%A5%F3%A5%BA%A5%D5%A5%A1%A5%C3%A5%B7%A5%E7%A5%F3+%3E%3E+%A4%BD%A4%CE%C2%BE&genreNewId=1020014530&itemName=1111111111&iconCode=1&usedFlag=0&caption=2222222222&checkUsePC=on&mobileCaption=&minPrice=1111&maxPrice=2222&stockConfirmFlag=false&taxCode=2&handlingNum=1&maxBidNum=1&stimestampYY=2011&stimestampMM=07&stimestampDD=03&stimestampHH=16&etimestampYY=2011&etimestampMM=07&etimestampDD=10&etimestampHH=15&exhibitionTimes=6&autoExtendFlag=1&prefectures=14&sizeAndWeight%5B0%5D=&sizeAndWeight%5B1%5D=999%2F999&sizeAndWeight%5B2%5D=&sizeAndWeight%5B3%5D=&sizeAndWeight%5B4%5D=&sizeAndWeight%5B5%5D=&companyAndService%5B6%5D=0120%2F510&sizeAndWeight%5B6%5D=101%2F999&sizeAndWeight%5B7%5D=&sizeAndWeight%5B8%5D=&sizeAndWeight%5B9%5D=&sizeAndWeight%5B10%5D=999%2F999&sizeAndWeight%5B11%5D=999%2F999&sizeAndWeight%5B12%5D=999%2F999&sizeAndWeight%5B13%5D=&sizeAndWeight%5B14%5D=&sizeAndWeight%5B15%5D=&sizeAndWeight%5B16%5D=&sizeAndWeight%5B17%5D=999%2F999&subConfirm=%A1%A1%BE%A6%C9%CA%BE%F0%CA%F3%A4%F2%B3%CE%C7%A7%A4%B9%A4%EB%A1%A1",			
		);
		//确认商品信息
		$postDate = array(
			'url' => 'https://auction.item.rms.rakuten.co.jp/rms/c2c/item/DI01P001_004',
			'data' => "org.apache.struts.taglib.html.TOKEN=2961c12532f10e000cf17ca6f7e4efff&subRegister=%CD%F8%CD%D1%B5%AC%CC%F3%A4%CB%C6%B1%B0%D5%A4%B7%A4%C6%BD%D0%C9%CA%A4%B9%A4%EB&d_id=7f9501ca8d1e96024f284b1e975571f0&adMail=on",			
		);
		
		//发送图片
		$postDate = array(
			'url' => 'https://auction.item.rms.rakuten.co.jp/rms/c2c/item/DI01P001_004',
			'data' => "",	
			
			/* Content-Disposition: form-data; name="token_key"

			A467682113094f6b46
			-----------------------------41184676334
			Content-Disposition: form-data; name="img1"; filename="letian.jpg"
			Content-Type: image/jpeg 

			https://auction.thumbnail.image.rakuten.co.jp/@0_auc/image18/temp/20/f1/0001133371800010005814121620.jpg?_ex=100x100
			https://auction.thumbnail.image.rakuten.co.jp/@0_auc/image18/temp/20/f1/0001133371800010005814221620.jpg?_ex=100x100
			https://auction.thumbnail.image.rakuten.co.jp/@0_auc/image18/temp/20/f1/0001133371800010005814321620.jpg?_ex=100x100
			图片分析　000	11333718	000	10005814	321620.jpg?_ex=100x100
			　　　　　　　　shopid			itemId
			*/		
		);
		
		//确认图片
		
		$postDate = array(
			'url' => 'https://auction.item.rms.rakuten.co.jp/rms/c2c/item/DI01P001_004',
			'data' => "",	
			
			/* 
			-----------------------------265001916915724
			Content-Disposition: form-data; name="__ce"

			CC01_002_001
			-----------------------------265001916915724
			Content-Disposition: form-data; name="token_key"

			A6701213096761f856
			-----------------------------265001916915724--

			*/		
		);
			

		
		exit($html);
		
	break;

	
}